package com.anXin.user.controller;


import com.anXin.model.common.dtos.ResponseResult;
import com.anXin.model.common.enums.AppHttpCodeEnum;
import com.anXin.model.user.pojos.Addr;
import com.anXin.model.user.pojos.User;
import com.anXin.model.user.pojos.UserEquipment;
import com.anXin.user.service.AddrService;
import com.anXin.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "个人地址接口" )
@RestController
@RequestMapping("/addr")
public class AddrController {

    @Resource
    private AddrService addrService;

    @ApiOperation("添加地址")
    @PostMapping("/add")
    private ResponseResult add(@RequestBody Addr addr){
        return addrService.add(addr);
    }

    @ApiOperation("更新地址")
    @PutMapping("/update")
    private ResponseResult updateEquipment(@RequestBody Addr addr){
        return addrService.updateEquipment(addr);
    }

    @ApiOperation("删除地址")
    @DeleteMapping("/delete/{id}")
    private ResponseResult delete(@PathVariable("id") Long id){
        return addrService.delete(id);
    }

    @ApiOperation("获取地址列表")
    @GetMapping("/list")
    private ResponseResult getList(){

        return addrService.getList();
    }

    @ApiOperation("获取地址信息")
    @GetMapping("/Info/{id}")
    public ResponseResult Info(@PathVariable("id")  Long id) {
        return addrService.Info(id);
    }
}